function getParam(paramName) {
    let paramValue = "", isFound = !1;
    if (this.location.search.indexOf("?") == 0 && this.location.search.indexOf("=") > 1) {
        arrSource = unescape(this.location.search).substring(1, this.location.search.length).split("&"), i = 0;
        while (i < arrSource.length && !isFound) {
            arrSource[i].indexOf("=") > 0 && arrSource[i].split("=")[0].toLowerCase() == paramName.toLowerCase() && (paramValue = arrSource[i].split("=")[1], isFound = !0), i++;
        }

    }
    return paramValue == "" && (paramValue = null), paramValue;
}


function dateFormat(date) {
    if(date === undefined){
        return '';
    }
    let tempDate = new Date(date).toJSON();
    let newDate = new Date(+new Date(tempDate) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '')
    return newDate;
}

function DateFunction(t) {
    if (t == null) {
        return "";
    }
    let time = t;
    let d = new Date(time);
    let times = d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate() + ' ' + d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds();
    return times;
}

function getNowDate() {
    let d = new Date();
    return d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate();
}

function getNowBefore() {
    let curDate = new Date();
    let d = new Date(curDate.getTime() - 24 * 60 * 60 * 1000); //前一天
    return d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate();
}

function getNowAfter() {
    let curDate = new Date();
    let d = new Date(curDate.getTime() + 24 * 60 * 60 * 1000); //后一天
    return d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate();
}

/*弹出层*/

/*
	参数解释：
	title	标题
	url		请求的url
	id		需要操作的数据id
	w		弹出层宽度（缺省调默认值）
	h		弹出层高度（缺省调默认值）
*/

function window_show(title, url, w, h) {
    window.parent.iw.open({
        id: title,
        title: title,
        href: url
    });
}

function layer_show(title, url, w, h) {
    if (title == null || title == '') {
        title = false;
    }
    ;
    if (url == null || url == '') {
        url = "404.html";
    }
    ;
    if (w == null || w == '') {
        w = 800;
    }
    ;
    if (h == null || h == '') {
        h = ($(window).height() - 15);
    }
    ;
    layer.open({
        type: 2,

        area: [w + 'px', h + 'px'],
        fix: false, //不固定
        maxmin: true,
        shade: 0.4,
        title: title,
        content: url,
        moveOut: true
    });

    function GetPercent(num, total) {
        /// <summary>
        /// 求百分比
        /// </summary>
        /// <param name="num">当前数</param>
        /// <param name="total">总数</param>
        num = parseFloat(num);
        total = parseFloat(total);
        if (isNaN(num) || isNaN(total)) {
            return "-";
        }
        return total <= 0 ? "0%" : (Math.round(num / total * 10000) / 100.00) + "%";
    }
}